<template>
  <div>
    <div class="search_box">
      <input type="text" name id placeholder="搜索商品" />
      <img src="../assets/xchx/ss.png" alt />
    </div>
    <!-- <div class="second_box">
      <ul>
        <li>
          <span>手机/数码/配件</span>
        </li>
        <li>
          <span>手机/数码/配件</span>
        </li>
        <li>
          <span>手机/数码/配件</span>
        </li>
        <li>
          <span>手机/数码/配件</span>
        </li>
        <li>
          <span>手机/数码/配件</span>
        </li>
      </ul>
    </div>-->

    <ly-tab v-model="selectedId" :items="items" :options="options" @change="onChange"></ly-tab>
    <div class="zhanwei"></div>
    <div>
      <div class="more_box">
        <div>魅力彩妆</div>
        <div>
          更多
          <span>></span>
        </div>
      </div>
      <div class="img_box">
        <div>
          <img src="../assets/xchx/kgwc.jpg" />
        </div>
        <div>
          <img src="../assets/xchx/kgwc.jpg" />
        </div>
        <div>
          <img src="../assets/xchx/kgwc.jpg" />
        </div>
        
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios"
export default {
  data() {
    return {
      selectedId: 0,
      items: [],
      itemID:"",
      options: {
        activeColor: "#1d98bd",
        labelKey:"name",
       
      }
    };
  },
  methods: {
    onChange(item, i) {
      this.getdata()
      this.itemID=item.id
     
    },
    getdata(){
      axios({
        url:"http://localhost/api.php/fulian/type",
        method:"get",
        params:{
          transform:1
        }
      }).then((res)=>{
        let Arr = res.data.type
        Arr.forEach((item,index,a) => {
          if(item.level=="一级"){
            this.items.push(item)
          }
          
        });
      })
    }
  },
  mounted() {
    this.getdata()
  }
};
</script>

<style>
.search_box {
  background: #008cd6;
  height: 40px;
  width: 320px;
  text-align: right;
  position: fixed;
  /* line-height: 21px; */
}
.search_box img {
  width: 20px;
  height: 20px;
  margin: 10px;
}
input {
  width: 243.19px;
  height: 30px;
  border-radius: 8px;
  text-align: center;
  position: absolute;
  top: 2px;
  left: 30px;
}
.ly-tab {
  position: fixed;
  top: 45px;
  width: 100%;
  height: 48px;
  z-index: 10;
  border-bottom: none;
  background: #a7d4ee;
}
.second_box ul {
  display: flex;
  list-style: none;
  width: 100%;
  overflow-x: scroll;
}
.second_box ul li {
  width: auto;
  position: relative;
  height: 45px;
  line-height: 40px;
  margin: 0;
  background: none;
  border-width: 0 0 1px;
  border-style: solid;
  border-color: #008cd6;
  box-sizing: border-box;
  background: #eff8fd;
  border-bottom: 1px solid #008cd6;
}
.second_box ul li span {
  width: 100%;
  border-right: 1px solid #e2e2e2;
  box-sizing: border-box;
  padding: 0 28px;
  font-size: 14px;
  display: inline-block;
  width: 153px;
  height: 18px;
  line-height: 18px;
  vertical-align: middle;
  overflow: hidden;
}
.zhanwei {
  height: 100px;
}
.more_box {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 12px;
}
.img_box{
  display: flex;
  justify-content: space-around;
  padding: 0 10px
}
.img_box div{
  width: 87.6px;
  height: 85.6px;
  border:1px solid rgb(228, 226, 226)
}
.img_box img{
  width: 85.6px;
  height: 85.6px;
}
</style>
